Parent Property 

The Parent property returns the parent of the object. Read-only.

Syntax

object.Parent

Data Type

Object

Remarks

The Parent property in the OLE Messaging Library returns the immediate parent of an object. For example, the immediate parent for each object is shown in the following table.

OLE Messaging Library object

Immediate parent in object hierarchy

AddressEntries collection

AddressList object

AddressEntry (returned by Session.CurrentUser)

AddressEntries collection

AddressEntry (all others)

Recipient object

AddressEntryFilter

AddressEntries collection

AddressList

AddressLists collection

AddressLists collection

Session object

Attachment

Attachments collection

Attachments collection

Message object

Field

Fields collection

Fields collection

AddressEntry, AddressEntryFilter, Folder (Inbox or Outbox), Message, or MessageFilter object

Folder (Inbox or Outbox)

Session object

Folder (all others)

Folders collection or InfoStore object

Folders collection

Folder (Inbox or Outbox)

InfoStore

InfoStores collection

InfoStores collection

Session object

Message

Messages collection

MessageFilter

Messages collection

Messages collection

Folder (Inbox or Outbox)

Recipient

Recipients collection

Recipients collection

Message object

Session

Set to Nothing

 

Note that the Parent property represents the immediate parent of the object, rather than the logical parent. For example, a folder contains a Messages collection, which contains Message objects. The Parent property for a message is the immediate parent, the Messages collection, rather than the logical parent, the Folder object.

The Session Object2KVAZVM object represents the highest level in the hierarchy of OLE Messaging Library objects and its Parent property is set to Nothing.

For more information on the OLE Messaging Library object hierarchy, see Object Model4HGZR9.

Example

This code fragment displays the name of the parent Messages collection of a MessageC062VO object:

' Function: Message_Parent

Function Message_Parent()

    ' error handling here

    If objOneMsg Is Nothing Then

        MsgBox "Need to select a message; see Messages->Get*"

        Exit Function

    End If

    ' Immediate parent of message is the messages collection

    MsgBox "Message immediate parent class = " & objOneMsg.Parent.Class

    ' error handling code

End Function

 

To get to the FolderKM47H0 object, you have to take the parent of the Messages collection object:

' Function: Messages_Parent

' Purpose: Display the Messages collection Parent class value

' See documentation topic: Parent property

Function Messages_Parent()

    ' error handling here...

    If objMessages Is Nothing Then

        MsgBox "No active messages collection"

        Exit Function

    End If

    MsgBox "Messages collection parent has class value: " & _

            objMessages.Parent.Class

    Exit Function

    ' error handling here...

End Function